import React, {Component, useState} from 'react';
import Money from "./components/Money";
import useMyBook from "./useMyBook";

function App() {

    const {bookName, setBookName } = useMyBook()
    const [value, setValue] = useState('')
    const handleChange = (e) => {
        setValue(e.target.value)
    }
    const handleClick = () => {
        setBookName(value)
    }

    return (
        <div>
            <div>{bookName}</div>
            <input type="text" value={value} onChange={handleChange} />
            <button onClick={handleClick}>确定</button>
        </div>
    );
}

export default App;